# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Tim S. <stahta01@gmail.com>

_realname=kicad-doc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-ca"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-de"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-en"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-es"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-fr"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-it"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ja"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-nl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-pl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ru")
pkgver=4.0.4
pkgrel=1
pkgdesc="Documentation for KiCad (mingw-w64)"
arch=('any')
url="http://kicad-pcb.org/download/source/"
license=('GPL3' 'custom')
makedepends=()
options=('!strip')
source=("http://downloads.kicad-pcb.org/docs/kicad-doc-${pkgver}.tar.gz")
sha256sums=('3f180197ac8963f129239922c62530313b3344bfc0ec40a6512defb086163722')
langid='en'

prepare() {
  plain "No step"
}

build() {
  plain "No step"
}

build_lang() {
  cd "${srcdir}/kicad-doc-${pkgver}/share/doc/kicad/help"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
  cp -R ${langid} "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
}

# Wrappers; the last called function seems to need either newline or ";" after it.
package_mingw-w64-x86_64-kicad-doc-ca() { langid='ca' build_lang; }
package_mingw-w64-i686-kicad-doc-ca()   { langid='ca' build_lang; }
package_mingw-w64-x86_64-kicad-doc-de() { langid='de' build_lang; }
package_mingw-w64-i686-kicad-doc-de()   { langid='de' build_lang; }
package_mingw-w64-x86_64-kicad-doc-en() { langid='en' build_lang; }
package_mingw-w64-i686-kicad-doc-en()   { langid='en' build_lang; }
package_mingw-w64-x86_64-kicad-doc-es() { langid='es' build_lang; }
package_mingw-w64-i686-kicad-doc-es()   { langid='es' build_lang; }
package_mingw-w64-x86_64-kicad-doc-fr() { langid='fr' build_lang; }
package_mingw-w64-i686-kicad-doc-fr()   { langid='fr' build_lang; }
package_mingw-w64-x86_64-kicad-doc-it() { langid='it' build_lang; }
package_mingw-w64-i686-kicad-doc-it()   { langid='it' build_lang; }
package_mingw-w64-x86_64-kicad-doc-ja() { langid='ja' build_lang; }
package_mingw-w64-i686-kicad-doc-ja()   { langid='ja' build_lang; }
package_mingw-w64-x86_64-kicad-doc-nl() { langid='nl' build_lang; }
package_mingw-w64-i686-kicad-doc-nl()   { langid='nl' build_lang; }
package_mingw-w64-x86_64-kicad-doc-pl() { langid='pl' build_lang; }
package_mingw-w64-i686-kicad-doc-pl()   { langid='pl' build_lang; }
package_mingw-w64-x86_64-kicad-doc-ru() { langid='ru' build_lang; }
package_mingw-w64-i686-kicad-doc-ru()   { langid='ru' build_lang; }
